package com.turing.post.transaction.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import com.turing.post.util.PCPSUtil;

/**
 * 商户交易附加产品明细
 * 
 * @author 李治
 * 
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "MCHADDTRADDETAIL")
@IdClass(MchAddTradDetail.class)
public class MchAddTradDetail implements Serializable {
	/**
	 * 商户ID
	 */
	private String merchantNo;
	/**
	 * 帐务日期
	 */
	private Date tranDate;
	/**
	 * 流水号
	 */
	private String tranSeqNo;
	/**
	 * 产品序号
	 */
	private Integer prodSeqNo;
	/**
	 * 商户产品 Id
	 */
	private String mrchProdId;
	/**
	 * 商户产品名称
	 */
	private String mrchProdName;
	/**
	 * 商户产品数量
	 */
	private BigInteger mrchProdQuantity;
	/**
	 * 商户产品单价
	 */
	private BigInteger mrchProdPrice;
	/**
	 * 商户产品总价
	 */
	private BigInteger mrchProdAmount;
	/**
	 * 折扣后价格
	 */
	private BigInteger mrchProdCost;
	/**
	 * 产品实际售价
	 */
	private BigInteger mrchProdFactSale;
	/**
	 * 邮局成本
	 */
	private BigInteger mrchProdProfitSYS;
	/**
	 * 商户方成本
	 */
	private BigInteger mrchProdProfitMCH;

	public MchAddTradDetail() {
		super();
	}

	public MchAddTradDetail(String merchantNo, Date tranDate, String tranSeqNo,
			Integer prodSeqNo, String mrchProdId, String mrchProdName,
			BigInteger mrchProdQuantity, BigInteger mrchProdPrice,
			BigInteger mrchProdAmount, BigInteger mrchProdCost,
			BigInteger mrchProdFactSale, BigInteger mrchProdProfitSYS,
			BigInteger mrchProdProfitMCH) {
		super();
		this.merchantNo = merchantNo;
		this.tranDate = tranDate;
		this.tranSeqNo = tranSeqNo;
		this.prodSeqNo = prodSeqNo;
		this.mrchProdId = mrchProdId;
		this.mrchProdName = mrchProdName;
		this.mrchProdQuantity = mrchProdQuantity;
		this.mrchProdPrice = mrchProdPrice;
		this.mrchProdAmount = mrchProdAmount;
		this.mrchProdCost = mrchProdCost;
		this.mrchProdFactSale = mrchProdFactSale;
		this.mrchProdProfitSYS = mrchProdProfitSYS;
		this.mrchProdProfitMCH = mrchProdProfitMCH;
	}

	@Id
	@Column(name = "MERCHANTNO", nullable = false)
	public String getMerchantNo() {
		return merchantNo;
	}

	public void setMerchantNo(String merchantNo) {
		this.merchantNo = merchantNo;
	}

	@Id
	@Column(name = "TRANDATE", nullable = false)
	public Date getTranDate() {
		return tranDate;
	}

	public void setTranDate(Date tranDate) {
		this.tranDate = tranDate;
	}

	@Id
	@Column(name = "TRANSEQNO", nullable = false)
	public String getTranSeqNo() {
		return tranSeqNo;
	}

	public void setTranSeqNo(String tranSeqNo) {
		this.tranSeqNo = tranSeqNo;
	}

	@Id
	@Column(name = "PRODSEQNO", nullable = false)
	public Integer getProdSeqNo() {
		return prodSeqNo;
	}

	public void setProdSeqNo(Integer prodSeqNo) {
		this.prodSeqNo = prodSeqNo;
	}

	@Column(name = "MRCHPRODID")
	public String getMrchProdId() {
		return mrchProdId;
	}

	public void setMrchProdId(String mrchProdId) {
		this.mrchProdId = mrchProdId;
	}

	@Column(name = "MRCHPRODNAME")
	public String getMrchProdName() {
		return mrchProdName;
	}

	public void setMrchProdName(String mrchProdName) {
		this.mrchProdName = mrchProdName;
	}

	@Column(name = "MRCHPRODQUANTITY")
	public BigInteger getMrchProdQuantity() {
		return mrchProdQuantity;
	}

	public void setMrchProdQuantity(BigInteger mrchProdQuantity) {
		this.mrchProdQuantity = mrchProdQuantity;
	}

	@Column(name = "MRCHPRODPRICE")
	public BigInteger getMrchProdPrice() {
		return mrchProdPrice;
	}

	public void setMrchProdPrice(BigInteger mrchProdPrice) {
		this.mrchProdPrice = mrchProdPrice;
	}

	@Column(name = "MRCHPRODAMOUNT")
	public BigInteger getMrchProdAmount() {
		return mrchProdAmount;
	}

	public void setMrchProdAmount(BigInteger mrchProdAmount) {
		this.mrchProdAmount = mrchProdAmount;
	}

	@Column(name = "MRCHPRODCOST")
	public BigInteger getMrchProdCost() {
		return mrchProdCost;
	}

	public void setMrchProdCost(BigInteger mrchProdCost) {
		this.mrchProdCost = mrchProdCost;
	}

	@Column(name = "MRCHPRODFACTSALE")
	public BigInteger getMrchProdFactSale() {
		return mrchProdFactSale;
	}

	public void setMrchProdFactSale(BigInteger mrchProdFactSale) {
		this.mrchProdFactSale = mrchProdFactSale;
	}

	@Column(name = "MRCHPRODPROFITSYS")
	public BigInteger getMrchProdProfitSYS() {
		return mrchProdProfitSYS;
	}

	public void setMrchProdProfitSYS(BigInteger mrchProdProfitSYS) {
		this.mrchProdProfitSYS = mrchProdProfitSYS;
	}

	@Column(name = "MRCHPRODPROFITMCH")
	public BigInteger getMrchProdProfitMCH() {
		return mrchProdProfitMCH;
	}

	public void setMrchProdProfitMCH(BigInteger mrchProdProfitMCH) {
		this.mrchProdProfitMCH = mrchProdProfitMCH;
	}

	@Override
	public int hashCode() {
		return PCPSUtil.getObjectListHashCode(new Object[] { getMerchantNo(),
				getTranDate(), getProdSeqNo(), getTranSeqNo() });
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof MchAddTradDetail))
			return false;
		MchAddTradDetail other = (MchAddTradDetail) obj;

		if (!PCPSUtil
				.compareObject(this.getMerchantNo(), other.getMerchantNo()))
			return false;
		if (!PCPSUtil.compareObject(this.getTranDate(), other.getTranDate()))
			return false;
		if (!PCPSUtil.compareObject(this.getTranSeqNo(), other.getTranSeqNo()))
			return false;
		return PCPSUtil
				.compareObject(this.getProdSeqNo(), other.getProdSeqNo());
	}

}
